CentOS 6
Sponsored Link

Install Ruby 2.3
2017/09/23
 
The version of Ruby in CentOS 6 repository is 1.8 but Install 2.3 with RPM package if you need.
[1] It's possible to install from CentOS SCLo Software Collections.
It's OK to install it even if 1.8 is already installed because 2.3 is located on another PATH.
# install from SCLo

[root@dlp ~]#
yum --enablerepo=centos-sclo-rh -y install rh-ruby23
[2] Packages from Software Collections are installed uder the /opt directory.
To use it, Load environment variables like follows.
# load environment variables

[root@dlp ~]#
scl enable rh-ruby23 bash
[root@dlp ~]#
ruby -v

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux-gnu]
[root@dlp ~]#
which ruby

/opt/rh/rh-ruby23/root/usr/bin/ruby
[3] If you'd like to enable Ruby 2.3 automatically at login time, configure like follows.
[root@dlp ~]#
vi /etc/profile.d/rh-ruby23.sh
# create new

#!/bin/bash

source /opt/rh/rh-ruby23/enable
export X_SCLS="`scl enable rh-ruby23 'echo $X_SCLS'`"
export PATH=$PATH:/opt/rh/rh-ruby23/root/usr/local/bin
 
Tweet